#include "Process.h"
#include "RenderManager.h"
#include <string>
#include "Core\Core.h"
#include "Utils\Base.h"
#include "InputManager.h"

CProcess::CProcess()
: m_bDebugInfo(false)
, m_pCamera(NULL) 
{}


CProcess::~CProcess()
{
	DeInit();
}

void CProcess::Init()
{
}

void CProcess::DeInit()
{
	m_pCamera = NULL; //La memoria ja esta alliberada...
}

void CProcess::Update(float dt)
{
}

void CProcess::RenderScene(CRenderManager* RM)
{
}

void CProcess::RenderScene2D(CRenderManager* RM, CFontManager* FM)
{
}

uint32 CProcess::RenderDebugInfo(CRenderManager* RM, CFontManager* FM, float FPS)
{

	uint32 posY = 0;
	uint32 posX = 0;
	if(m_bDebugInfo)
	{
		CInputManager* inputManager = CORE->GetInputManager();
		Vect2i mousePos;

		inputManager->GetPosition(IDV_MOUSE,mousePos);


		posY+=FM->DrawDefaultText(posX,posY,colWHITE,"_________________PROCESS INFORMATION_______________" );
		posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- Press X to show/hide this information");


		if (inputManager->HasGamePad(IDV_GAMEPAD1) )
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad1 is connected" );
		}
		else
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad1 is not connected" );
		}
		if (inputManager->HasGamePad(IDV_GAMEPAD2) )
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad2 is connected" );
		}
		else
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad2 is not connected" );
		}
		if (inputManager->HasGamePad(IDV_GAMEPAD3) )
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad3 is connected" );
		}
		else
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad3 is not connected" );
		}
		if (inputManager->HasGamePad(IDV_GAMEPAD4) )
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad4 is connected" );
		}
		else
		{
			posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- GamePad4 is not connected" );
		}

		posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- FPS: %f", FPS );
		posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- Pointer mouse position: (%d,%d)", mousePos.x,mousePos.y);

	}

	else
	{
		posY+=FM->DrawDefaultText(posX,posY,colWHITE,"- Press X to view the Process Info (FPS: %f)", FPS);	
	}

   return posY;
}